package demo7;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("demo7");
        System.out.println("Spring容器初始化完毕了...");
        Person person = context.getBean(Person.class);
        System.out.println("通过容器获取了Person对象");

        /*
            当我们关闭Spring容器时，容器会陆续调用它内部管理的对象的销毁方法来通知这件事
         */
        context.close();//关闭容器
        System.out.println("Spring容器关闭了!");

    }
}
